import java.util.Queue;
import java.util.Stack;

/*
 *@Student 张策
 */
public class b {

    public boolean IsPopOrder (int[] pushV, int[] popV) {
        Stack<Integer> stack = new Stack<>();
        int j=0;
        for (int i = 0; i < pushV.length; i++) {
            stack.push(pushV[i]);
                while (!stack.isEmpty()&&stack.peek() == popV[j]){
                 stack.pop();
                 if (j==popV.length-1){
                     return true;
                 }//
                 j++;
                }
        }
        return j==popV.length;
    }

    public static void main(String[] args) {
        b b = new b();
        int[]arr={2,1,0},arr2={1,2,0};
        System.out.println(b.IsPopOrder(arr, arr2));

    }
}
